1. Field
Embodiments relate to processors and other instruction processing apparatus. In particular, embodiments relate to methods, apparatus, systems, or instructions, to update internal state of processors and other instruction processing apparatus.
2. Background Information
Certain processors use pipelined execution to overlap execution phases, which may allow multiple instructions to be in different phases of execution at the same time, which may help to improve performance. The amount of parallelism achieved tends to increase as the pipeline depth increases. Over time, certain processors have incorporated deeper pipelining in an attempt to improve performance. Pipelining tends to be more effective when the instruction stream is known so that the pipeline can be kept full and the execution of a subsequent instruction does not need to await the results of those in the pipeline.
To help keep the pipeline more full, pipelined processors have used dynamic prediction (e.g., branch prediction) and speculative execution. The dynamic prediction may be used to predict the flow of instructions in the instruction stream and inject instructions of the predicted path into the pipeline. Branch prediction may involve predicting the direction of a branch, for example the direction of a conditional branch instruction, before the correct direction of the branch is definitively known. For example, the processor may make an educated guess about what direction the conditional branch instruction is most likely to take based on past history. The processor may then start executing instructions speculatively based on the assumption that the predicted branch direction is correct, but before the processor knows whether or not the predicted branch direction is actually correct.
The dynamic prediction (e.g., the predicted branch direction) will later turn out either to be correct or incorrect. If the predicted branch direction later turns out to be correct, then the results of the speculative execution may be utilized. In this case, the speculative execution offers value in greater utilization of pipeline stages that would otherwise have been dormant or at least underutilized, while waiting for the correct direction of the branch direction to be known. Alternatively, if the predicted branch direction turns out to be incorrect, or the branch direction was mispredicted, then the speculatively execution past the conditional branch instruction typically should be discarded, and the execution typically should be rewound by jumping or branching back in the control flow to the conditional branch that was mispredicted. Execution may then resume, now non-speculatively, with the now definitively known correct branch direction.